/// <reference path="../bs4/scss/bootstrap.scss" />
/// <reference path="../../Content/bs4/scss/_variables.scss" />

/* File Upload
------------------------------------*/
.fu-container {
    position: relative;

    &.dz-highlight .dropzone-container,
    &.dz-drag-hover .dropzone-container {
        border-color: $primary !important;
        background-color: lighten($primary, 50%) !important;
        pointer-events: none;
    }

    > .dz-preview {
        display: none !important;
    }

    .fu-message {
        cursor: pointer;
    }

    // Xl display.
    &.xl {
        .fu-message {
            font-size: $h5-font-size !important;
        }

        .dropzone-file-info,
        .fu-fileupload {
            justify-content: center;
            text-align: center;
        }
    }

    &:not(.xl) {
        .dropzone-target {
            padding: 10px;
        }

        .fu-buttons .btn {
            @extend .btn-sm;
        }
    }

    // Progress bars.
    .fu-progress:not(.list) {
        position: absolute;
        left: 0;
        bottom: -1px;
        right: 0;

        .progress {
            height: 0.25rem;
            background: transparent;
            margin: 0;
            border-radius: 0;
            border-bottom-left-radius: $input-border-radius;
            border-bottom-right-radius: $input-border-radius;
            box-shadow: none;

            .progress-bar {
                background-color: $primary;
                transition: width 0.25s ease, background-color 0.25s ease;
            }
        }

        &.success {
            transition-delay: 0.4s;
        }

        &.success .progress-bar {
            background-color: $success !important;
        }
    }

    .customer-avatar-lg {
        display: block;
    }

    .empty {
        font-weight: $font-weight-normal !important;
        color: $gray-600 !important;
    }
}

// Dropzone skinning
.dropzone-container {
    pointer-events: initial !important;
    transition: all .2s;
    align-items: center;
    display: flex;
    position: relative;
    border: 2px dashed $gray-400 !important;
    background: $gray-100 !important;
    border-radius: 5px;

    &.fullscreen {
        position: relative;
        width: 100%;
        height: 100%;

        .fu-message {
            display: flex;
            justify-content: center;
            align-items: center;
            height: 100%;
        }
    }

    &.hide {
        display: none;
    }

    .dropzone {
        border: none;
        background: none;
        width: 100%;
        padding: 20px;
    }

    .fu-fileupload,
    .fu-message {
        font-size: $font-size-lg;
        align-self: center;
        color: var(--primary-dark);

        &.empty {
            //font-size: $font-size-lg;
        }
    }

    .dz-preview, .dz-message {
        display: none;
    }

    .fu-thumb {
        position: relative;
        margin: 0.5rem;
        display: flex;
        align-items: center;
        justify-content: center;
        width: 90px;
        height: 90px;
        min-width: 90px;

        .xl & {
            min-width: 120px;
            width: 120px;
            height: 120px;
        }

        &.empty {
            border: 2px dashed $gray-400;

            .file-icon {
                color: rgba(#000, 0.12);
            }
        }

        .file-figure {
            max-width: 100%;
            max-height: 100%;

            .file-thumb {
                display: flex;
                align-self: auto;
                justify-content: center;
            }
        }

        .file-img {
            max-width: 100%;
            max-height: 100%;
            border: 1px solid rgba(#000, 0.1);
            box-shadow: $box-shadow-sm-var;
        }
    }

    .fu-controls {
        flex-grow: 1;
        overflow: hidden;
    }

    .fu-remove {
        display: none;
        min-width: 1.25rem;
        width: 1.25rem;
        height: 1.25rem;

        &:hover {
            background-color: rgba($danger, .2);
        }

        .fu-remove-icon {
            margin-top: -2px;
        }
    }
}

.fu-file-preview {
    margin: 0 10px 10px 0;
    position: relative;
    border: 1px solid $gray-400;
    border-radius: $border-radius-sm;
    background: $light;
    display: flex;
    justify-content: center;
    overflow: hidden;

    .main-pic-badge {
        display: none;
        position: absolute;
        z-index: 1000;
        right: 0;
        border-top-left-radius: 0;
        border-bottom-right-radius: 0;
    }

    #product-edit &:first-child .main-pic-badge {
        display: block;
    }

    .file-figure {
        min-width: $file-thumbnail-min-size;
        max-width: $file-thumbnail-max-width;
        height: $file-thumbnail-min-size;

        .file-icon:not(.show) {
            display: none;
        }

        .file-img {
            max-width: 100%;
            max-height: $file-thumbnail-min-size;
            height: $file-thumbnail-min-size;
            object-fit: contain;
        }
    }

    .toolbar {
        position: absolute;
        bottom: 0;
        min-width: 100%;
        background-color: $gray-100;
        visibility: hidden;
        transition: visibility 0.1s;
        border-top: 1px solid $gray-500;
        z-index: 2;
        cursor: default;

        > .btn {
            border-radius: 0 !important;
        }
    }

    .fu-file-info-container {
        position: absolute;
        transition: opacity .3s;
        opacity: 0;
        visibility: visible;
        background-color: rgba($indigo, 0.7);
        z-index: 2;

        .drag-gripper {
            width: fit-content;
            cursor: move;
            z-index: 10;

            .drag-icon {
                width: 2.75rem;
                height: 2.75rem;
                line-height: 2.75rem;
            }
        }

        .fu-file-info-name {
            z-index: 2;
            padding: 0 0.5rem;
            text-shadow: 1px 1px 1px rgba(#000, 0.5);
            line-height: 1.3;
            max-height: calc(#{$font-size-base} * 1.3 * 3);
            max-width: 100%;
            overflow: hidden;
            word-break: break-all;
            margin-bottom: .75rem;
        }

        .fu-preview-control-menu {
            z-index: 5;
            margin-top: -6px;

            > * {
                margin-top: 6px;
            }
        }
    }

    &:hover:not(.sortable-ghost) {
        border: 1px solid $gray-400;

        .toolbar {
            visibility: visible;
        }

        .fu-preview-overlay {
            visibility: visible;
            opacity: .5;
        }

        .fu-file-info-container {
            opacity: 1;
            backdrop-filter: blur(2px);
        }
    }

    &:not(.dz-success), &.dz-processing {
        .drag-gripper, .fu-preview-control-menu {
            visibility: hidden !important;
        }
    }

    &.sortable-ghost .toolbar {
        visibility: hidden;
    }
}

// FileConflictResolutionDialog
#duplicate-window {
    .remaining-file-counter {
        float: right;
        padding-top: 10px;
    }

    .file-display {
        border: 1px solid $gray-400;

        .file-info {
            overflow: hidden;
        }

        .file-figure {
            width: 100px;
            height: 80px;
            display: flex;
            margin: 0;
            align-items: center;
            justify-content: center;
        }

        .file-img {
            width: 100px;
            height: 80px;
            object-fit: cover;
        }

        .file-date {
            white-space: nowrap;
            overflow: hidden;
        }
    }
}
